/**
 * @description: 利用递归实现深拷贝
 *             let obj = {
 *               name: '张干',
                    mgs: {
                            age: 18
                            },
                            info: ['1', 2, 3] 
                        }
                let o = {}
                deepCopy(o, obj)
                console.log(o);
 * @param {*产生新的值} newObj
 * @param {*输入旧的值} oldObj
 * @return {*}
 * @author: CHY
 */
function deepCopy(newObj, oldObj) {
    for (let k in oldObj) {
        let item = oldObj[k]
        if (item instanceof Array) {
            newObj[k] = []
            deepCopy(newObj[k], item)
        } else if (item instanceof Object) {
            newObj[k] = {}
            deepCopy(newObj[k], item)
        } else {
            newObj[k] = item
        }
    }
}